<?php

namespace app\api\model;

use think\Model;
use think\model\concern\SoftDelete;

class GoodsCateModel extends ApiModel
{

    use SoftDelete;

    

    // 表名
    protected $name = 'goods_cate';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    protected $deleteTime = 'delete_time';

    // 追加属性
    protected $append = [

    ];


    //获取分类
    public function getGoodsCate(){
        $list = self::where(['status' =>1])->field('id,name')->order('sort desc')->select()->toArray();
        $newElement = ['id' => 0, 'name' => '栀芋圈子'];
        array_unshift($list, $newElement);
        return $this->api_success('获取成功',$list);
    }







}
